#pragma once

class LoadingScreen : public Singleton<LoadingScreen>
{
	Texture* m_screenTexture;
	Texture* m_barBorder;
	Texture* m_fillTexture;
	Vertex3FRHWT m_baseVertices[4];
	Vertex3FRHWT m_borderVertices[4];
	Vertex3FRHWT m_fillVertices[4];
	ui32 m_tilesLoaded;
	ui32 m_lastRender;
public:
	LoadingScreen();
	void Render();
	void SetMap(ui32 map);
	void Resize();
	void TileLoaded()
	{
		if(sD3D.GetAppState() == STATE_LOADING)
		{
			++m_tilesLoaded;
			if(GetTickCount() - m_lastRender > (1000.0f / 60.0f))
			{
				sD3D.Render();
				m_lastRender = GetTickCount();
			}
		}
	}
};

#define sLoading (*LoadingScreen::GetInstance())